requirejs.config({
	urlArgs: 'v=1202'+Math.random(),
	baseUrl : '../js/libs',
	paths : {
		jquery : 'jquery.min',
		jquery_route : 'jquery.route',
        jquerycookie: 'jquery.cookie',
		jquery_artmodel : "jquery.artmodel",
		jquery_qrcode : "jquery.qrcode.min",
		bootstrap : "../../bootstrap-3.3.5/dist/js/bootstrap.min",
		bootstrapselectbase : "../plugins/bootstrap-select/js/bootstrap-select",
		bootstrapselect:"../plugins/bootstrap-select/js/i18n/defaults-zh_CN",
		menu : "../modules/menu",
		config : "../common/config",
		common : "../common/common",
		login : "../common/login",
        pageJs: '../common/pageJs',
        stringUtil: "../common/string-util",
        bootstrap_paginator:'../plugins/bootstrap-paginator/bootstrap-paginator',
		arttemplateUtil : '../common/arttemplate-util',
		indexController : "../modules/index/indexController",
        calendar1:'calendarpicker1',
        calendar:'calendarpicker',
		wdatePicker:"../plugins/My97DatePicker/WdatePicker",
        validform:"../plugins/Validform/Validform_v5.3.2",
        arttemplateUtil: '../common/arttemplate-util',
        area:'../modules/order/area',
		main : "../modules/main",
		demo:"../modules/demo/demoController",
	},
	shim : { //引入没有使用requirejs模块写法的类库。backbone依赖underscore
		'jquery' : {
			exports : '$'
		},
		'bootstrap' : [ 'jquery'],
        'bootstrap_paginator':{
        	deps:['bootstrap'],
        	exports: 'bootstrp'
        },
        'calendar':['jquery'],
        'calendar1':['jquery'],
		'bootstrapselectbase':['bootstrap'],
		'bootstrapselect':['bootstrapselectbase'],
		'main' : [ 'indexController' ],
		'validform':['jquery'],
		'area':['jquery']
	}
});
require([ 'config', 'jquery', 'jquery_route', 'common', 'arttemplateUtil',
		'menu', 'main', 'bootstrap','calendar','calendar1'], function(config, $, jquery_route,
		common, arttemplate, menu, main) {
	if(typeof window.GLOBAL == 'object'){
		window.GLOBAL.$LOADHTML=undefined;
	}
	var app = {
		init : function() {
			// 需要初始化菜单
			if (true) {
				//开发测试使用
				menu.init(menu.menu_config());
			} else {
    			common.common_ajax_request('/api/farmUser/v1/queryUserRoleMenu',{userid:$.cookie("token")},false,function(data,code,msg){
    				if(msg.businessCode==0){
    					var recode ={data:data};
    					console.info(recode,"recode");
						menu.init(recode);
    				}else{
    					menu.init(menu.menu_config());
    				}
    			});
				/*$.ajax({
					url : config.apiRoot() + '/api/farmUser/v1/queryUserRoleMenu',
					type : "get",
					dataType : "json",
					data :{userid:$.cookie("token")},
					success : function($menu_config) {
						console.info($menu_config,"$menu_config.dat2a");
						menu.init($menu_config.data);
					},
					error : function() {
						menu.init(menu.menu_config());
					}
				});*/
			}
			main.init();
		    $(window).resize(function() {
			       app.setMainHeight();
			    });
	        app.setMainHeight();
            
        },
        setMainHeight: function() {
        	var MainHeight= $(window).height()- ($("#fam-page-wrapper > #content-header").outerHeight() || 0)-($("#fam-page-wrapper > #content-footer").outerHeight() || 0);
        		$("#content-main").css("height",MainHeight);
        	
        }
	};
	app.init();
});